package com.cisetech.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cisetech.mapper.bobocai.CodeMapper;
import com.cisetech.service.CodeService;
import com.cisetech.vo.Page;
import com.cisetech.vo.bobocai.CodeVo;

@Service
public class CodeServiceImpl implements CodeService{

	@Autowired
	CodeMapper codeMapper;
	
	@Override
	public int addCode(CodeVo codeVo) {
		return codeMapper.addCode(codeVo);
	}

	@Override
	public Page<CodeVo> getlists(CodeVo codeVo) {
		codeVo.setProductType("1");
		Page<CodeVo> page = new Page<CodeVo>();
		if(codeVo!=null && codeVo.getPageNo()>0){
			codeVo.setCalculationPge((codeVo.getPageNo()-1)*codeVo.getPageSize());
		}
		List<CodeVo> list = codeMapper.getlists(codeVo);
		Integer i = codeMapper.getlistCont(codeVo);
		page.Pagehtml(codeVo.getPageNo(), codeVo.getPageSize(), i, list);
		return page;
	}

	@Override
	public int delectCode(CodeVo codeVo) {
		// TODO Auto-generated method stub
		return codeMapper.delectCode(codeVo.getId());
	}

	@Override
	public List<CodeVo> getlistss(CodeVo codeVo) {
		// TODO Auto-generated method stub
		return codeMapper.getlistss(codeVo);
	}

	@Override
	public int updateByPrimaryKeySelective(CodeVo codeVo) {
		// TODO Auto-generated method stub
		return codeMapper.updateByPrimaryKeySelective(codeVo);
	}

}
